package com.zygame.sdk.view.floatbutton;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.zygame.sdk.ZyGameSDK;
import com.zygame.sdk.utils.res.ResourceUtil;
import com.zygame.sdk.view.BaseDialog;


public class HideFloatButtonDialog extends BaseDialog implements OnClickListener{
	
	private Context mContext;
	
	private Button comfirm;
	private Button cancel;
	
	public HideFloatButtonDialog(Context context, int width, int height) {
		super(context, width, height);
		this.mContext = context;
		this.setCanceledOnTouchOutside(true);
	}
	
	public HideFloatButtonDialog(Context context){
		this(context, 260, 150);
		this.mContext = context;
		this.setCanceledOnTouchOutside(true);
	}
	
	private void init(Context context){
		comfirm = (Button) findViewById(ResourceUtil.getId(mContext, "comfirm"));
		cancel = (Button) findViewById(ResourceUtil.getId(mContext, "cancel"));
	
		comfirm.setOnClickListener(this);
		cancel.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		int viewId = v.getId();
		if(viewId == ResourceUtil.getId(mContext, "comfirm")){
			ZyGameSDK.getInstance().hideFloatButton();
			this.dismiss();
		}else if(viewId == ResourceUtil.getId(mContext, "cancel")){
			this.dismiss();
		}
	}

	@Override
	protected void subOnCreate() {
		setContentView(ResourceUtil.getLayoutId(mContext, "fy_ly_dialog_hide_floatbutton"));
		init(mContext);
	}
}
